import 'package:flutter/cupertino.dart';

class DraggableImage extends StatefulWidget {
  const DraggableImage({super.key});

  @override
  _DraggableImageState createState() => _DraggableImageState();
}

class _DraggableImageState extends State<DraggableImage> {
  double _topPosition = 0.0;

  void _updatePosition(double update) {
    setState(() {
      _topPosition += update;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Positioned(
          top: _topPosition,
          child: GestureDetector(
            onVerticalDragUpdate: (DragUpdateDetails details) {
              _updatePosition(
                  details.globalPosition.dy - details.localPosition.dy);
            },
            child: Image.network(
              'https://picsum.photos/250?image=9', // Replace with your image URL
              width: 250,
              height: 250,
            ),
          ),
        ),
      ],
    );
  }
}
